#!/usr/bin/env ruby

LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.dirname(File.realpath($PROGRAM_NAME))))

require "#{LKP_SRC}/lib/log"

stats = Hash.new { |h, k| h[k] = [] }

while (line = $stdin.gets)
  case line
  when /^rsa.*4096.*bits/
    stats['sign_per_sec'] = line.split[5]
    stats['verify_per_sec'] = line.split[6]
  when /^sha256.*/
    stats['16_size_block_Kbps'] = line.split[1].delete('k').to_f
    stats['64_size_block_Kbps'] = line.split[2].delete('k').to_f
    stats['256_size_block_Kbps'] = line.split[3].delete('k').to_f
    stats['1024_size_block_Kbps'] = line.split[4].delete('k').to_f
    stats['8192_size_block_Kbps'] = line.split[5].delete('k').to_f
    stats['16384_size_block_Kbps'] = line.split[6].delete('k').to_f
  end
end

stats.each do |k, v|
  puts "#{k}: #{v}"
end
